"use strict";
cc._RF.push(module, '042377PUYRPTali4eyUhay1', 'bageScrollView');
// Script/bageScrollView.js

"use strict";

var _XmlHttpTool = require("./XmlHttpTool");

var _XmlHttpTool2 = _interopRequireDefault(_XmlHttpTool);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var bageItem = cc.Class({
    name: 'bageItem',
    properties: {

        rankName: cc.String,
        rankheadimage: cc.Integer,
        status: cc.String

    }
});

cc.Class({
    extends: cc.Component,

    properties: {

        items: {
            default: [],
            type: bageItem
        },
        itemPrefab: cc.Prefab,
        bageAllScrollView: cc.Node,
        nothingSprites: cc.Node,
        bageCloseBtn: cc.Button

    },

    closeClick: function closeClick() {

        var changebig = cc.scaleTo(0.02, 1.2);

        var finish = cc.callFunc(function () {

            var that = this;
            var changesmail = cc.scaleTo(0.08, 1.0);

            var smaillfinish = cc.callFunc(function () {

                that.bageAllScrollView.active = false;
            });

            var seq2 = cc.sequence(changesmail, smaillfinish);
            this.bageCloseBtn.node.runAction(seq2);
        }, this);

        var seq = cc.sequence(changebig, finish);

        this.bageCloseBtn.node.runAction(seq);
    },

    onLoad: function onLoad() {},
    init: function init() {

        if (this.items.length > 0) {
            this.node.removeAllChildren();
        }

        var that = this;
        _XmlHttpTool2.default.NhttpPost("/marmot/user_prize", {}, function (res) {
            console.log("奖品列表", res);
            that.items = res;
            if (that.items.length == 0) {
                that.nothingSprites.active = true;
            }
            for (var i = 0; i < that.items.length; ++i) {

                var item = cc.instantiate(that.itemPrefab);
                that.node.addChild(item);
                item.getComponent('bagePrefab').init(that.items[i]);
            }
        });
    },
    start: function start() {}
});

cc._RF.pop();